﻿using Firestarter.DB.Schema.BO;
using FireStarterModeller.Test;
using Habanero.Testability;

namespace Firestarter.DB.Schema.Test.BO.TestUtils
{
    public partial class TestUtilsDBKey
    {
        
        public static BOTestFactory<DBKey> GetTestFactory()
        {
            return BOTestFactoryRegistry.Instance.Resolve<DBKey>();
        }
        /// <summary>
        /// Creates a new saved DBKey with a random value assigned to every property
        /// </summary>
        public static DBKey CreateSavedDBKey()
        {
            DBKey dBKey = CreateUnsavedValidDBKey();
            dBKey.Save();
            return dBKey;
        }

        /// <summary>
        /// Creates a new unsaved DBKey with a random value assigned to every property
        /// </summary>
        public static DBKey CreateUnsavedValidDBKey()
        {
            DBKey dBKey = new DBKey();
            dBKey.KeyName = TestUtilsShared.GetRandomString();
            dBKey.TableID = TestUtilsDBTable.CreateSavedDBTable().TableID;
//			dBKey.PendingChangeType = null;
            dBKey.Approved = TestUtilsShared.GetRandomBoolean();
            return dBKey;
        }
	    
        /// <summary>
        /// Creates a new unsaved DBKey where all properties are null, except ID properties
        /// and those with default values.  If there are compulsory properties without
        /// defaults, saving the object will throw an exception.
        /// </summary>
        public static DBKey CreateUnsavedDefaultDBKey()
        {
            DBKey dBKey = new DBKey();
            return dBKey;
        }
    }
}